package com.net.framework.help.utils;

import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;

/**
 * @author zhangxiaobin
 * @version V1.0
 * @ClassName: WebViewAdaptiveDisplay.java
 * @email 154722566@qq.com
 * @Date 2016年7月16日 上午10:09:05
 * @Description: WebView自适应展示
 */
public class WebViewAdaptiveDisplay {
    /**
     * 直接网络图片显示
     */
    public static void webImage(WebView webView, String url) {
        webView.setVisibility(View.VISIBLE);
        WebSettings settings = webView.getSettings();
        if (android.os.Build.VERSION.SDK_INT < 19) {
            settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
        } else {
            settings.setUseWideViewPort(true);
        }
        settings.setLoadWithOverviewMode(true);
        webView.getSettings().setSupportZoom(false);
        webView.getSettings().setBuiltInZoomControls(false);
        try {
            webView.loadUrl(url);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
